package com.xckj.cycling.global;

import com.xckj.cycling.bean.BaseBean;
import com.xckj.cycling.bean.DeviceAddedResponseBean;
import com.xckj.cycling.bean.UserInfoResponseBean;

import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * @Author: ChenYao
 * @Describe: Api接口
 * @Date: 2023/2/26 19:40
 */
public interface ApiService {
    /**
     * 登录
     *
     * @param account  账号
     * @param password 密码
     * @return 用户信息
     */
    @POST("qixing/user/login")
    @FormUrlEncoded
    Call<BaseBean<UserInfoResponseBean>> login(@Field("account") String account, @Field("password") String password);

    /**
     * 注册
     *
     * @param email    邮箱
     * @param code     验证码
     * @param password 密码
     * @return 用户信息
     */
    @POST("qixing/user/register")
    @FormUrlEncoded
    Call<BaseBean<UserInfoResponseBean>> register(@Field("email") String email, @Field("code") String code, @Field("password") String password);

    /**
     * 完善注册
     *
     * @param name    姓名
     * @param age     年龄
     * @param gender  性别 0:女 1:男 2:其他
     * @param weight  体重
     * @param perfect 注册完善资料必传1
     * @return 完善注册成功与否
     */
    @POST("qixing/user/profile")
    @FormUrlEncoded
    Call<BaseBean<String>> perfectRegister(@Field("name") String name, @Field("age") String age, @Field("gender") int gender, @Field("weight") String weight, @Field("perfect") String perfect,@Field("region") String city);

    /**
     * 忘记密码
     *
     * @param email       邮箱
     * @param captcha     验证码
     * @param newpassword 新密码
     * @return 修改结果
     */
    @POST("qixing/user/resetpwd")
    @FormUrlEncoded
    Call<BaseBean<String>> forgetPassword(@Field("email") String email, @Field("captcha") String captcha, @Field("newpassword") String newpassword);

    /**
     * 发送验证码
     *
     * @param event 验证类型:register=注册,resetpwd=忘记密码
     * @param email 邮箱
     * @return 是否成功发送
     */
    @POST("ems/send")
    @FormUrlEncoded
    Call<BaseBean<String>> sendCode(@Field("event") String event, @Field("email") String email);

    /**
     * 获取已绑定设备
     *
     * @return 已绑定设备
     */
    @POST("qixing/equipment/blist")
    @FormUrlEncoded
    Call<BaseBean<DeviceAddedResponseBean>> getDeviceAdded(@Field("page") String page, @Field("pageSize") String pageSize);

    /**
     * 绑定设备
     */
    @POST("qixing/equipment/binding")
    @FormUrlEncoded
    Call<BaseBean<String>> bindDevice(@Field("sn") String mac, @Field("name") String name);

    /**
     * 蓝牙更新设备数据
     */
    @POST("qixing/equipment/updateequipment")
    @FormUrlEncoded
    Call<BaseBean<String>> reportDeviceData(@Field("model") String model,
                                            @Field("curr_dangwei") String curr_dangwei,
                                            @Field("curr_sudu") String curr_sudu,
                                            @Field("avg_sudu") String avg_sudu,
                                            @Field("zuida_sudui") String zuida_sudui,
                                            @Field("electricity") String electricity,
                                            @Field("totalmileage") String totalmileage,
                                            @Field("canmileage") String canmileage,
                                            @Field("danci") String danci,
                                            @Field("sn") String mac);

}
